package com.cw.controller;


import com.cw.annotation.AutoYard;
import com.cw.common.api.*;
import com.cw.request.*;
import com.cw.service.*;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;

/**
 * @author smq
 * @since 2021-05-05
 */
@Api(tags = {"his床位"})
@RestController
@RequestMapping("/his-cwgl-bed")

public class HisCwglBedController {

    @Autowired
    private IHisCwglBedService targetService;

    @ApiOperation(value = "获取空闲床位His")
    @PostMapping("/getEemptyBedsListHis")
    public ResultObject getEemptyBedsListHis(@RequestBody AllSickBedsRequest param) {
        return getEemptyBedsListNew(param);
    }

    @AutoYard
    @ApiOperation(value = "获取空闲床位新")
    @PostMapping("/getEemptyBedsListNew")
    public ResultObject getEemptyBedsListNew(@RequestBody AllSickBedsRequest param) {
        return ResultObject.successReturn(targetService.getEemptyBedsListNew(param));
    }

    @ApiOperation(value = "获取床位详情")
    @PostMapping("/getEemptyBedsDetailsNew")
    public ResultObject getEemptyBedsDetailsNew(@RequestBody AllSickBedsRequest param) {
        return ResultObject.successReturn(targetService.getEemptyBedsDetailsNew(param));
    }

    @ApiOperation(value = "获取床位详情")
    @PostMapping("/getReservationDetail")
    public ResultObject getReservationDetail(@RequestBody AllSickBedsRequest param) {
        return ResultObject.successReturn(targetService.getReservationDetail(param));
    }

    @ApiOperation(value = "获取日间床位详情")
    @PostMapping("/getReservationRjssDetail")
    public ResultObject getReservationRjssDetail(@RequestBody AllSickBedsRequest param) {
        return ResultObject.successReturn(targetService.getReservationRjssDetail(param));
    }

    @ApiOperation(value = "根据患者获取空床位")
    @PostMapping("/getEemptysByPatien")
    public ResultObject getEemptysByPatien(@RequestBody EmptyBedsRequest emptyPatientRequest) {
        return ResultObject.successReturn(targetService.getEemptysByPatien(emptyPatientRequest));
    }

    @ApiOperation("获取集中管理空床/总集中管理床位")
    @GetMapping("/getAllManageBed")
    public ResultObject getAllManageBed(@RequestParam String yard) {
        return ResultObject.successReturn(targetService.getAllManageBed(yard));
    }


    /**
     * 开立电子住院证页面，根据选择的病区，获取该病区下空床的编号，查CWGL_BED视图
     * @param nurseCellCode
     * @return
     */
    @ApiOperation("开立电子住院证/获取空床下拉")
    @GetMapping("/getKongBedList")
    public ResultObject getKongBedList(@RequestParam String nurseCellCode) {
        return ResultObject.successReturn(targetService.getKongBedList(nurseCellCode));
    }

}

